#include<stdio.h>
#include<stdlib.h>

struct Stu 
{
	//结构体成员
	char name[20];
	int age;
	float score;
};

//使用结构体指针
void print(struct Stu *ps)
{
	printf("%s %d %.1f\n", (*ps).name, (*ps).age, (*ps).score);
	//->
	//结构：结构体指针变量->成员名
	printf("%s %d %.1f\n", ps->name, ps->age, ps->score);
	
}

int main()
{
	//输入结构体内容
	struct Stu s1 = {"张三",20,99.0};
	struct Stu s2 = {"李四",18,95.0};
	//结构：结构体对象.成员名
	printf("%s %d %.1f\n", s1.name, s1.age, s1.score);
	printf("%s %d %.1f\n", s2.name, s2.age, s2.score);
	//自定义函数实行结构体指针变量
	print(&s1);
	
    printf("\n按任意键继续...");
	getchar();
	
	return 0;
}
